home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tphrt3.zip / TESTBIOS.PAS < prev    next >
Pascal/Delphi Source File  |  1990-07-18  |  6KB  |  159 lines

  1. program testbios;
  2. {----------------------------------------------------------------------------
  3.  |  Program TESTBIOS.PAS                                                    |
  4.  |                                                                          |
  5.  |  This program demonstrates the BIOS timing capability of the TPHRT       |
  6.  |  t_bios timer functions in a Turbo Pascal environment.  The user may     |
  7.  |  select from several BIOS interrupts to "exercise", and appropriate      |
  8.  |  activity is generated, along with a BIOS timer summary.  MSDOS          |
  9.  |  interrupt 21h is timed in all cases, showing the user the               |
  10.  |  relationship between hardware and operating system overhead.            |
  11.  |                                                                          |
  12.  |  (c)1989 Ryle Design, P.O. Box 22, Mt. Pleasant, Michigan 48804          |
  13.  |                                                                          |
  14.  |  V3.00 Shareware Evaluation Version                                      |
  15.  ----------------------------------------------------------------------------}
  16. uses
  17.     crt, printer, tphrt;
  18.  
  19. var
  20.     atom : byte;
  21.     hits : longint;
  22.     rt   : longint;
  23.     ts   : string;
  24.  
  25.  
  26. procedure do_crt;
  27. {----------------------------------------------------------------------------
  28.  |  This procedure enables CRT & MSDOS timing, generates some CRT           |
  29.  |  activity, and displays a BIOS timer summary.                            |
  30.  |                                                                          |
  31.  |  Globals referenced: none                                                |
  32.  |                                                                          |
  33.  |  Arguments: void                                                         |
  34.  |                                                                          |
  35.  |  Returns  : void                                                         |
  36.  ----------------------------------------------------------------------------}
  37. var
  38.     indx : integer;
  39.  
  40. begin
  41.  
  42.     t_bios_start(CRT10 + DOS21);
  43.  
  44.     for indx := 1 to 20 do writeln('Ryle Design ... Purveyors of Big Science');
  45.  
  46.     t_bios_report(0);
  47.  
  48.     t_bios_stop;
  49.  
  50. end; { do_crt }
  51.  
  52.  
  53. procedure do_disk;
  54. {----------------------------------------------------------------------------
  55.  |  This procedure enables DISK & MSDOS timing, generates some disk         |
  56.  |  activity, and displays a BIOS timer summary.                            |
  57.  |                                                                          |
  58.  |  Globals referenced: none                                                |
  59.  |                                                                          |
  60.  |  Arguments: void                                                         |
  61.  |                                                                          |
  62.  |  Returns  : void                                                         |
  63.  ----------------------------------------------------------------------------}
  64. var
  65.     indx : integer;
  66.     df   : file of integer;
  67. begin
  68.  
  69.     t_bios_start(DISK+DOS21);
  70.  
  71.     write('Creating data file ... ');
  72.     assign(df,'TEST.DAT');
  73.     rewrite(df);
  74.     writeln('complete.');
  75.  
  76.     write('Writing 32k bytes two bytes at a time ... ');
  77.     for indx := 1 to 16384 do write(df,indx);
  78.     writeln('complete.');
  79.  
  80.     write('Closing and erasing file ... ');
  81.     close(df);
  82.     erase(df);
  83.     writeln('complete.');
  84.  
  85.     t_bios_report(0);
  86.  
  87.     t_bios_stop;
  88.  
  89. end; { do_disk }
  90.  
  91.  
  92. procedure do_printer;
  93. {----------------------------------------------------------------------------
  94.  |  This procedure enables PRT & MSDOS timing, generates some printer       |
  95.  |  activity, and displays a BIOS timer summary.                            |
  96.  |                                                                          |
  97.  |  Globals referenced: none                                                |
  98.  |                                                                          |
  99.  |  Arguments: void                                                         |
  100.  |                                                                          |
  101.  |  Returns  : void                                                         |
  102.  ----------------------------------------------------------------------------}
  103. var
  104.     indx : integer;
  105.     atom : char;
  106.  
  107. begin
  108.  
  109.     write('Make sure printer is online and ready.  Press any key to continue >> ');
  110.     atom := readkey;
  111.  
  112.     t_bios_start(PRT+DOS21);
  113.  
  114.     for indx := 1 to 10 do writeln(lst,'Ryle Design ... Purveyors of Big Science');
  115.  
  116.     t_bios_report(0);
  117.  
  118.     t_bios_stop;
  119.  
  120. end; { do_printer }
  121.  
  122.  
  123. begin
  124.  
  125.     directvideo := FALSE;      { force this so video goes through the BIOS }
  126.  
  127.     t_start;
  128.     t_entry(1);
  129.  
  130.     writeln('TestBios   TPHRT V3 Demonstration Series');
  131.     writeln;
  132.     writeln('Make sure the files 10.INT, 13.INT, 17.INT, and 21.INT are in this directory.');
  133.     writeln;
  134.  
  135.     repeat
  136.  
  137.         writeln('0 ... Profile BIOS interrupt 10h (CRT) ');
  138.         writeln('1 ... Profile BIOS interrupt 13h (Disk)');
  139.         writeln('2 ... Profile BIOS interrupt 17h (Printer)');
  140.         writeln('3 ... Exit');
  141.         write('Select 0-3 >> ');
  142.         readln(atom);
  143.  
  144.         case atom of
  145.           0 : do_crt;
  146.           1 : do_disk;
  147.           2 : do_printer;
  148.         end;
  149.  
  150.     until (atom = 3);
  151.  
  152.     t_exit(1);
  153.     t_ask_timer(1,hits,rt);
  154.     t_stop;
  155.  
  156.     writeln('TestBios complete.  Elapsed time: ',t_cvt_time(rt,ts));
  157.  
  158. end. { testbios }
  159.